import java.io.*;

public class finish_number {
     public static void main(String args[]) throws IOException{
     	InputStreamReader in=new InputStreamReader(System.in);
		BufferedReader bin=new BufferedReader(in);

         int i,j,sum=0;
         for(i=1;i<1000;i++){
             sum = 0;
             for(j = 1;j <=i/2;j++){
                 if(i%j==0){
                     sum += j;
                 }
             }
             if(sum == i){
                 System.out.print(i+" ");
             }
         }
     }
 }